Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




remove( ) FUNCTION


The 'remove( )' Function function is used to remove a particular value from the List..


Let us say, we have a List that contains three names, 'Mohan', 'Kriti' and 'Salim'. And we want to remove 'Kriti' from the List.


Example :


x = ["Mohan", "Kriti", "Salim"]
x.remove("Kriti")
print(x) 


Output :



  ['Mohan', 'Salim']

So, in the above code we have created a 'List' and initialised to the variable 'x'.


x = ["Mohan", "Kriti", "Salim"]

Below is how the values are positioned in the List,


java_Collections

Next, we have used the 'remove( )' function that searches for the name 'Kriti' and removes it from the List.


x.remove("Kriti")

java_Collections

And we get the below output,


['Mohan', 'Salim']